<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Welcome to iTerm2 Browser</title>
    <style>
        {{COMMON_CSS}}
        
        .container {
            max-width: 900px;
            margin: 0 auto;
            padding: 60px 20px;
        }
        
        .welcome-header {
            text-align: center;
            margin-bottom: 60px;
        }
        
        .welcome-title {
            font-size: 2.5em;
            font-weight: 700;
            margin-bottom: 16px;
            background: linear-gradient(135deg, var(--accent-color), #5ac8fa);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        
        .welcome-subtitle {
            font-size: 1.2em;
            color: var(--secondary-text);
            margin-bottom: 8px;
        }
        
        .section-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 32px;
        }
        
        .section-title {
            font-size: 1.4em;
            font-weight: 600;
            color: var(--text-color);
        }
        
        .refresh-button {
            background: transparent;
            border: 1px solid var(--border-color);
            color: var(--text-color);
            padding: 8px 16px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 0.9em;
            transition: all 0.2s ease;
        }
        
        .refresh-button:hover {
            background: var(--section-bg);
            border-color: var(--accent-color);
        }
        
        #top-sites-list {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
            gap: 20px;
            margin-bottom: 40px;
        }
        
        .site-card {
            background: var(--section-bg);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            padding: 20px;
            text-decoration: none;
            color: var(--text-color);
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 16px;
            cursor: pointer;
        }
        
        .site-card:hover {
            background: var(--button-bg);
            transform: translateY(-2px);
            box-shadow: 0 6px 20px var(--shadow);
            border-color: var(--accent-color);
        }
        
        .site-card:hover .site-url,
        .site-card:hover .site-visits {
            color: var(--primary-text);
        }
        
        .site-favicon {
            width: 48px;
            height: 48px;
            flex-shrink: 0;
            position: relative;
        }
        
        .site-favicon img {
            width: 100%;
            height: 100%;
            object-fit: contain;
            border-radius: 8px;
        }
        
        .site-favicon-fallback {
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, var(--accent-color), #5ac8fa);
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5em;
            font-weight: bold;
            border-radius: 8px;
        }
        
        .site-info {
            flex: 1;
            min-width: 0;
        }
        
        .site-title {
            font-weight: 600;
            font-size: 1.1em;
            margin-bottom: 4px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        
        .site-url {
            color: var(--secondary-text);
            font-size: 0.9em;
            margin-bottom: 4px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        
        .site-visits {
            color: var(--secondary-text);
            font-size: 0.85em;
            opacity: 0.8;
        }
        
        .empty-state {
            text-align: center;
            padding: 60px 20px;
            color: var(--secondary-text);
        }
        
        .empty-icon {
            font-size: 4em;
            display: block;
            margin-bottom: 20px;
            opacity: 0.5;
        }
        
        .empty-state p {
            font-size: 1.2em;
            margin-bottom: 12px;
        }
        
        .empty-hint {
            font-size: 1em !important;
            opacity: 0.7;
        }
        
        .quick-links {
            background: var(--section-bg);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            padding: 24px;
            margin-top: 40px;
        }
        
        .quick-links-title {
            font-size: 1.2em;
            font-weight: 600;
            margin-bottom: 16px;
            color: var(--text-color);
        }
        
        .quick-links-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 12px;
        }
        
        .quick-link {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 12px 16px;
            background: transparent;
            color: var(--accent-color);
            text-decoration: none;
            border: 1px solid var(--border-color);
            border-radius: 8px;
            transition: all 0.2s ease;
            font-size: 0.95em;
        }
        
        .quick-link:hover {
            background: var(--accent-color)10;
            border-color: var(--accent-color);
        }
        
        @media (max-width: 600px) {
            .welcome-title {
                font-size: 2em;
            }
            
            #top-sites-list {
                grid-template-columns: 1fr;
            }
            
            .quick-links-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="welcome-header">
            <h1 class="welcome-title">Welcome Back</h1>
            <p class="welcome-subtitle">Pick up where you left off</p>
        </div>
        
        <div class="section-header">
            <h2 class="section-title">Top Sites</h2>
            <button class="refresh-button" onclick="refreshTopSites()">Refresh</button>
        </div>
        
        <div id="top-sites-list">
            <!-- Top sites will be populated here by JavaScript -->
        </div>
        
        <div class="quick-links">
            <h3 class="quick-links-title">Quick Actions</h3>
            <div class="quick-links-grid">
                <a href="iterm2-about:bookmarks" class="quick-link">
                    <span>📚</span>
                    <span>Bookmarks</span>
                </a>
                <a href="iterm2-about:history" class="quick-link">
                    <span>📜</span>
                    <span>History</span>
                </a>
                <a href="iterm2-about:settings" class="quick-link">
                    <span>⚙️</span>
                    <span>Settings</span>
                </a>
                <a href="iterm2-about:permissions" class="quick-link">
                    <span>🔒</span>
                    <span>Permissions</span>
                </a>
            </div>
        </div>
    </div>
    
    <script>
        {{WELCOME_SCRIPT}}
    </script>
</body>
</html>